<html lang="en">
<head>
    <title>攻略明细管理</title>
    <#include "../common/header.ftl">
    <script type="text/javascript">
        $(function () {
            //查询
            $(".clickBtn").click(function () {
                var parentId = $(this).data("parentid");
                $("#currentPage").val(1);
                $("#searchForm").submit();
            })


            //发布： 改状态
            $(".changeStateBtn").click(function () {
                var state = $(this).data("state");
                var id = $(this).data("id");

                $.get("/travel/changeState", {state: state, id: id}, function (data) {
                    if (data.success) {
                        window.location.reload();
                    } else {
                        $.messager.alert("温馨提示", data.msg);
                    }
                })

            })

            //查看游记
            $('.inputBtn').click(function () {
                var id = $(this).data("id");
                $('.modal-body').html('');
                $.get("/travel/look", {id: id}, function (data) {
                    $('.modal-body').html(data.travelContent.content);
                    $('#myModal').modal('show');
                })
            })
        })

    </script>
    <style>
        #myModal img {
            width: 100%;
        }
    </style>
</head>
<body>
<!--左侧菜单回显变量设置-->
<#assign currentMenu="travel">

<div class="container-fluid " style="margin-top: 20px">
    <#include "../common/top.ftl">
    <div class="row">
        <div class="col-sm-2">
            <#include "../common/menu.ftl">
        </div>
        <div class="col-sm-10">
            <div class="row">
                <div class="col-sm-12">
                    <h1 class="page-head-line">游记管理</h1>
                </div>
            </div>
            <#setting number_format="#">
            <!--高级查询--->
            <form class="form-inline" id="searchForm" action="/travel/list" method="post">
                <input type="hidden" name="currentPage" id="currentPage" value="1">
                <#--<a href="/travel/input" class="btn btn-success"><span class="glyphicon glyphicon-plus"></span>  添加</a>-->
            </form>

            <table class="table table-striped table-hover">
                <thead>
                <tr>
                    <th>序号</th>
                    <th>封面</th>
                    <th>目的地</th>
                    <th>作者</th>
                    <th>旅游时间</th>
                    <th>人均消费</th>
                    <th>旅游天数</th>
                    <th>几个人旅游</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
                </thead>
                <#list pageInfo.list as entity>
                    <tr>
                        <td>${entity_index+1}</td>
                        <td><img src="${entity.coverUrl!}" width="100px" height="60px"></td>
                        <td>${entity.dest.name!}</td>
                        <td>${(entity.author.nickname)!}</td>
                        <td>${(entity.travelTime)?string('yyyy-MM-dd')}</td>
                        <td>${entity.perExpends!}</td>
                        <td>${entity.days!}</td>
                        <td>${entity.personDisplay!}</td>
                        <td>${entity.stateDisplay!}</td>
                        <td>

                            <#if  entity.state == 2>
                                <a class="btn btn-danger btn-xs changeStateBtn" href="javascript:;" data-state='3'
                                   data-id="${entity.id}">
                                    <span class="glyphicon glyphicon-minus-sign"></span> 拒绝
                                </a>

                            <#else>
                                <a class="btn btn-default btn-xs changeStateBtn" href="JavaScript:;" data-state="2"
                                   data-id="${entity.id}">
                                    <span class="glyphicon glyphicon-tag"></span> 发布
                                </a>
                            </#if>


                            <a class="btn btn-info btn-xs inputBtn" href="JavaScript:;" data-id="${entity.id}">
                                <span class="glyphicon glyphicon-edit"></span> 查看
                            </a>

                            <#--<a href="javascript:;" class="btn btn-danger btn-xs deleteBtn"
                               data-url="/travel/delete?id=${entity.id}">
                                <span class="glyphicon glyphicon-trash"></span> 删除
                            </a>-->
                        </td>
                    </tr>
                </#list>
            </table>
            <#--分页-->
            <#include "../common/page.ftl"/>
        </div>
    </div>
</div>

<#--模态框-->

<div class="modal fade bs-example-modal-lg" tabindex="-1" id="myModal" role="dialog" aria-labelledby="myLargeModalLabel">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">游记内容</h4>
            </div>
            <div class="modal-body">

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>

</body>
</html>